package com.hnhn.c68.boot.ch1.controller;

import com.hnhn.c68.boot.ch1.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {
    /*@Value("${server.port}")
    private String port;*/

    @Autowired
    Environment environment;

    @Autowired
    User user;

    @GetMapping("/user")
    public User info() {
        return user;
    }

    @GetMapping("/ch1")
    public String test1() {
        //return "hello,boot!"+"-->"+port;
        return "hello,boot ccc!"+"-->"+environment.getProperty("server.port");
    }
}
